<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>选中一段内容，点击按钮复制选中的内容。</title>
</head>

<body>
  <p>暑假打算但是觉得你就爱上</p>
  <button onclick="aa()">复制</button>
</body>
<script>
  function aa() {
    document.execCommand('copy');
  }
</script>

</html>